package com.zhuss.core.auth;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.zhuss.core.auth.FeignAuthenticationInterceptor;

@Configuration
public class WebConfig implements WebMvcConfigurer {
	
	@Autowired
	private FeignAuthenticationInterceptor feignAuthenticationInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册自定义拦截器，添加拦截路径和排除拦截路径
        registry.addInterceptor(feignAuthenticationInterceptor).addPathPatterns("/**").excludePathPatterns("/error");
    }
    
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/wpsFile/**").addResourceLocations("file:/home/file/wpsFile/upload/");
		WebMvcConfigurer.super.addResourceHandlers(registry);
	}
}